package com.qf.administration.controller;

import com.github.pagehelper.PageInfo;
import com.qf.administration.qo.ManageQO;
import com.qf.administration.service.ManageService;
import com.qf.administration.vo.ManageVo;
import com.qf.common.base.result.RespResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Title: ManageController
 * @Description:
 * @author:ZWX
 * @date: 2023/5/20 16:06
 */
@Api(tags = "会议室管理")
@RestController
@RequestMapping("/manage")
public class ManageController {
    @Resource
    private ManageService manageService;

    /* @GetMapping("/list")
     public RespResult<IPage<ManageVo>> list(int page,int size,String sortName,String meetingRoomName){
         return null;
     }*/
    @ApiOperation("添加会议室信息")
    @PostMapping("/add")
    @ApiResponses({@ApiResponse(code = 200, message = "成功")})
    public RespResult<String> addManage(@RequestBody ManageQO manageQo) {
        return manageService.addManage(manageQo);
    }

    @ApiOperation("伪删除会议室信息")
    @PutMapping("/delete")
    public RespResult<String> deleteManage(@RequestParam int[] ids) {
        return manageService.deleteManage(ids);
    }

    @ApiOperation("修改会议室信息")
    @PutMapping("/update")
    public RespResult<String> updateManage(@RequestBody ManageQO manageQo) {
        return manageService.updateManage(manageQo);
    }

    @ApiOperation("查询会议室信息")
    @GetMapping("/list")
    public RespResult<PageInfo<ManageVo>> queryManage(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size, @RequestParam(required = false) String meetingRoomName, @RequestParam(required = false) String sortName) {
        return RespResult.success(manageService.queryManage(page, size, meetingRoomName, sortName));
    }

    @ApiOperation("查询会议室单条信息")
    @GetMapping("/one")
    public ManageVo queryManageOne(@RequestParam int id) {
        return manageService.queryManageOne(id);
    }
}

